package com.leyou.order.config;

import com.leyou.common.utils.IdWorker;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 初始化分布式ID工具类
 */
@Configuration
public class IdWorkerConfig {

    @Bean
    public IdWorker idWorker(IdWorkerProperties idWorkerProperties){
        return new IdWorker(idWorkerProperties.getWorkerId(),idWorkerProperties.getDataCenterId());
    }
}
